package com.itheima.Demo;

import java.util.HashMap;
import java.util.Set;

public class Demo03MapMap {
    public static void main(String[] args) {
        HashMap<String,String> map1 = new HashMap<>();
        //添加
        map1.put("罗志祥","蝴蝶");
        map1.put("陈羽凡","白百何");
        map1.put("文章","姚笛");
        //令狐冲-小尼姑  张无忌-赵敏       郭靖-黄蓉
        HashMap<String,String> map2 = new HashMap<>();
        map2.put("令狐冲","小尼姑");
        map2.put("张无忌","赵敏");
        map2.put("郭靖","黄蓉");
        //保存两个集合以及他们的队名
        HashMap<String ,HashMap<String,String>> map = new HashMap<>();
        //添加
        map.put("现代队",map1);
        map.put("古代队",map2);
        System.out.println(map);
        //作业：遍历这个嵌套的集合。因为是两层map集合，所以需要两次keySet()
        Set<String> keySet = map.keySet();
        for (String key : keySet) {
            HashMap<String, String> map3 = map.get(key);
            Set<String> keySet1 = map3.keySet();
            for (String key2 : keySet1) {
                String value01 = map3.get(key2);
                System.out.println(key+"="+key2+"="+value01);
            }
        }


    }
}
